package 游游的you;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int T = in.nextInt();
        while (T-- > 0) {
            int y = in.nextInt();
            int o = in.nextInt();
            int u = in.nextInt();
            int res = 0;
            res = Math.min(y, Math.min(o, u));
            o -= res;
            res *= 2;
            if (o > 0) {
                res += o - 1;
            }
            System.out.println(res);
        }
    }
}
